package fudan.se.project.repository.projection;

import fudan.se.project.domain.conference.post.Rebuttal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class RebuttalProjection {

    private final Rebuttal rebuttal;

    private RebuttalProjection(Rebuttal rebuttal) {
        this.rebuttal = rebuttal;
    }

    public long getId(){
        return rebuttal.getId();
    }

    public String getArgument() {
        return rebuttal.getArgument();
    }

    public PostProjection getPost() {
        return PostProjection.project(rebuttal.getPost());
    }


    public static RebuttalProjection project(Rebuttal rebuttal) {
        return new RebuttalProjection(rebuttal);
    }

    public static List<RebuttalProjection> project(Collection<Rebuttal> rebuttals) {
        ArrayList<RebuttalProjection> arrayList = new ArrayList<>(rebuttals.size());
        for (Rebuttal value : rebuttals) {
            arrayList.add(project(value));
        }
        return arrayList;
    }
}
